package ua.eug.robov2.screens;

import ua.eug.robov2.R0b0Game;
import ua.eug.robov2.menus.MenuClickListener;
import ua.eug.robov2.menus.SideMenu;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.scenes.scene2d.Stage;

public class MazeScreen implements Screen, MenuClickListener {

	static final String[] menuItems = {"wrench", "trash", "tube"};
	
	private R0b0Game r0b0;
	private Stage stage;
	
	public MazeScreen (R0b0Game r0b0) {
		this.r0b0 = r0b0;
		stage = new Stage();
		
	}

	@Override
	public void render(float delta) {
		Gdx.gl.glClearColor(0.2f, 0.2f, 0.8f, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
		stage.draw();
	}

	@Override
	public void resize(int width, int height) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void show() {
		Gdx.input.setInputProcessor(stage);
		SideMenu menu = SideMenu.getInstance();
		menu.newMenu(menuItems, this );		
		stage.addActor(menu);
	}

	@Override
	public void hide() {
	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Boolean clicked(String name) {
		if (name.equals("tube")) {
			r0b0.setSchScreen();
		}

		return true;
	}

}
